package com.ys.web.user.complain.mapper;

import com.ys.base.BaseMapper;
import com.ys.web.user.complain.po.ComplainPO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author quxinjun
 * @version 1.0.0
 * @ClassName ComplainMapper.java
 * @Description 投诉 mapper
 * @createTime 2021年05月24日 10:42:00
 */
@Mapper
public interface ComplainMapper extends BaseMapper<ComplainPO> {
    @Select("SELECT id,cause,pic,content,phone,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') createTime,`status`,`type` FROM `s_complain` " +
            "where user_id =  #{uid} ORDER BY id DESC ")
    List<ComplainPO> complainList(@Param("uid") Long uid);

    @Delete("delete from FROM `s_complain` where id = #{complainId} and user_id =  #{uid}")
    int complainDel(@Param("uid")Long uid, @Param("complainId")long complainId);
}
